<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        const arr = ['胡歌', '彭于晏', '侯卿']
        let [hug, pyy, hq] = arr
        console.log(hug,pyy,hq); 
        // 两个变量交换
        let a=1
        let b=2;//加分号是让解析不会到一行上变成这样报错let b=2 [b,a]=[a,b]
        [b,a]=[a,b]
        console.log(a,b);

        const ajb={
            name:'胡歌',
            age:40,
            fu:function a(e) {
                console.log('彭于晏');
            }
        }
        // 可以改名 旧名：新名
        let {name:uname,age,fu}=ajb
        console.log(uname,age,fu);
        fu();



        // 数组对象
        let arr1=[{names:'xj',p:37}]
        let [{names,p}]=arr1
        console.log(names,p);
    </script>
</body>

</html>